function convertByteToIec(size_B)
{
	var iec_array = new Array('B','KiB','MiB','GiB','TiB');
	var iec_num = parseFloat(size_B);
	for(var i=0;iec_num>1024;i++)
	{
		iec_num = iec_num/1024;
	}
	if(i>=3)
	{
		iec_num = iec_num.toFixed(2);
	}
	else
	{
		iec_num = iec_num.toFixed(0);
	}
	return iec_num+" "+iec_array[i];
}
function convertByteToSi1000(size_B)
{
	var si1000_array = new Array('B','KB','MB','GB','TB');
	var si1000_num = parseFloat(size_B);
	for(var i=0;si1000_num>1000;i++)
	{
		si1000_num = si1000_num/1000;
	}
	if(i>=3)
	{
		si1000_num = si1000_num.toFixed(2);
	}
	else
	{
		si1000_num = si1000_num.toFixed(0);
	}
	return si1000_num+" "+si1000_array[i];
}
function displayIecFileSize()
{
    var all_td = document.getElementsByTagName("td");
    for(var i=0;i<all_td.length;i++)
    {
		if(all_td[i].className=="iec_size")
		{
			//alert(all_td[i].firstChild.nodeValue);
			var size_B = all_td[i].firstChild.nodeValue;
			//var xx = strstr(size_b,1,3);
			//alert(xx);
			var iec_size = convertByteToIec(size_B);
			var si1000_size = convertByteToSi1000(size_B);
			all_td[i].firstChild.nodeValue = iec_size+"("+si1000_size+")";
		}
    }
}

addEvent(window,'load',displayIecFileSize);